//package cn.hn.yh.shiro;
//
//import org.apache.shiro.authc.AuthenticationException;
//import org.apache.shiro.authc.AuthenticationInfo;
//import org.apache.shiro.authc.AuthenticationToken;
//import org.apache.shiro.authc.SimpleAuthenticationInfo;
//import org.apache.shiro.authz.AuthorizationInfo;
//import org.apache.shiro.realm.AuthorizingRealm;
//import org.apache.shiro.subject.PrincipalCollection;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.core.env.Environment;
//
//public class UserRealm extends AuthorizingRealm {
//    @Autowired
//    private Environment environment;
//
//    @Override
//    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
//        return null;
//    }
//
//    @Override
//    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
//        String username = environment.getProperty("user.username");
//        String password = environment.getProperty("user.password");
//        String principal = (String) authenticationToken.getPrincipal();
//        System.out.println(principal);
//        if (username.equals(principal)) {
//            return new SimpleAuthenticationInfo(principal, password, this.getName());
//        }
//        return null;
//    }
//}
